import { Body, Controller, Header, Headers, Request, Post, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { ApiHeader, ApiTags, PickType } from '@nestjs/swagger';
import { Users } from './users.schema';
import { UsersService } from './users.service';

@Controller('users')
@ApiTags('用户及用户信息模块')
@ApiHeader({
  name: 'Authorization',
  required: true,
})
@UseGuards(AuthGuard('jwt'))
export class UsersController {
  constructor(private readonly usersService: UsersService) { }

  @Post('getUserInfo')
  async getUserInfo(@Request() req) {
    return this.usersService.getUserInfo(req.user.uuid as Users['uuid']);
  }

  @Post('updateUserInfo')
  async updateUserInfo(@Body() user: Users) {
    return this.usersService.updateUserInfo(user);
  }
}
